package Thread.Demo2;

import java.util.concurrent.ArrayBlockingQueue;

public class ThreadDemo {
    public static void main(String[] args) {
        /**
         * 利用阻塞队列完成生产者和消费者代码
         */

        //创建一个阻塞队列
        ArrayBlockingQueue<String> queue =new ArrayBlockingQueue<>(1);

        //这里将队列传了过去,由于队列是对象,而对象是引用数据类型,随意,他们都指向了同一个指针
        Cook cook = new Cook(queue);
        Foodie foodie =new Foodie(queue);

        cook.start();
        foodie.start();

    }
}
